New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

json-schema-table

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-schema-table

Creates and maintains a SQL table structure

  • 1.0.25
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by20%
Maintainers
1
Weekly downloads
 
Created
Source

json-schema-table NPM version Dependency Status CircleCI Coverage Status

Creates and maintains a SQL table structure equivalent to a json schema definition. For MSSQL and Postgres

First you create all your tables and then syncronizes then with each other to create the references. You can sync whenever you modify your json schema

Install

$ npm install --save json-schema-table

Usage

var jsonSchemaTable = require('json-schema-table');
var pg = require('pg-cr-layer');
var studentSchema = require('./student.json');
var classSchema = require('./class.json');

// initialize and connect to a database

var studentTable = jsonSchemaTable('person', studentSchema, {db: pg});
var classTable = jsonSchemaTable('student', classSchema, {db: pg});

// First create then sync to build the references
studentTable.create().then(function() {
	return classTable.create();
}).then(function() {
	return studentTable.sync();
}).then(function() {
	return classTable.sync();
}).catch(function(error) {
	console.log(error);
});

For the db connection you can use mssql-cr-layer or pg-cr-layer

To more details take a look at the tests

License

MIT © Andre Gloria

Keywords

FAQs

Package last updated on 28 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc